package ar.edu.unq.leezsi.utils;

import java.util.Random;

public class RandomUtils {
	private static final String CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

	private static synchronized String getIdOfLength(int length) {
		StringBuffer buffer = new StringBuffer(length);
		Random rnd = new Random();
		for (int i = 0; i < length; i++) {
			buffer.append(CHARACTERS.charAt(rnd.nextInt(CHARACTERS.length())));
		}
		return buffer.toString();
	}

	public static synchronized String getLongestId() {
		return getIdOfLength(30);
	}

}
